package top.lyc829.zzl_android.ui.profile.user_fans;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

import top.lyc829.zzl_android.MyApp;
import top.lyc829.zzl_android.R;
import top.lyc829.zzl_android.logic.bean.UserInfoBean;
import top.lyc829.zzl_android.ui.profile.user_dtc.travels.UserTravelsAdapter;

public class UserFansAdapter extends BaseQuickAdapter<UserInfoBean, BaseViewHolder> implements LoadMoreModule {
    public UserFansAdapter(){super(R.layout.user_fans_item);}
    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, UserInfoBean userInfoBean) {
        baseViewHolder.setText(R.id.user_fans_nickname,userInfoBean.getNickname());
        baseViewHolder.setText(R.id.user_fans_signature,userInfoBean.getSignature());
        baseViewHolder.setText(R.id.user_fans_attentioned,userInfoBean.getIsLike());

        if(userInfoBean.getIsLike().equals("0"))
        {
            baseViewHolder.setVisible(R.id.user_fans_attentioned,true);
            baseViewHolder.setText(R.id.user_fans_attentioned,"关注");
            baseViewHolder.setBackgroundResource(R.id.user_fans_attentioned,R.drawable.btn_un_attentioned);
        }
        else if(userInfoBean.getIsLike().equals("1"))
        {
            baseViewHolder.setVisible(R.id.user_fans_attentioned,true);
            baseViewHolder.setText(R.id.user_fans_attentioned,"已关注");
            baseViewHolder.setBackgroundResource(R.id.user_fans_attentioned,R.drawable.btn_attentioned);
        }
        else if(userInfoBean.getIsLike().equals("-1"))
        {

            baseViewHolder.setVisible(R.id.user_fans_attentioned,false);
        }
        Glide.with(MyApp.getContext())
                .load(userInfoBean.getAvatarUrl())
                .into((ImageView) baseViewHolder.getView(R.id.user_fans_avatar));
    }
}
